//线下培训包括近期与历史培训
function jingqi_lishi() {
	$("#kechengpeixun>article>.xixi>.xianxia>.yuyue>ul").empty();
	$("#kechengliebiao>article>ul").empty();
	new Ajax("/xianxiapeixun").keyvalue("type", 3).getJson(function(json) {
		$.each(json, function(v, k) {
			xa(k, 3);
		})
	})
	$("#kechengpeixun>article>.xixi>.xianxia>.jiazai_1").on("click", function() {
		$("#kechengliebiao>article>ul").empty();
		new Ajax("/xianxiapeixun").keyvalue("type", 2).getJson(function(json) {
			$.each(json, function(v, k) {
				peixun(k);
			})
		})
	})
}

//线下培训
function xa(v, quanbu) {
	var start = new Date(v["starttime"] * 1000).toLocaleString().substr(0, 10);
	var end = new Date(v["endtime"] * 1000).toLocaleString().substr(0, 10);
	if(quanbu) {
		$("#kechengpeixun>article>.xixi>.xianxia>.yuyue>ul").append("<li dataid=" + v["id"] + ">" + "<a href=/fenxiang/peixun.html?dataid=" + v["id"] + ">" + "<img src=" + http + v["ico"] + ">" + "<h1>" + v["title"] + "</h1>" + "<div></div><h3>" + start + "-" + end + "</h3>" + "</a>" + "</li>");
	} else {
		$("#kechengliebiao>article>ul").append("<li dataid=" + v["id"] + ">" + "<a href=#xianxiapeixun>" + "<img src=" + http + v["ico"] + ">" + "<h1>" + v["title"] + "</h1>" + "<div></div><h3>" + start + "-" + end + "</h3>" + "</a>" + "</li>");
	}
}

function peixun(v) {
	var start = new Date(v["starttime"] * 1000).toLocaleString().substr(0, 10);
	var end = new Date(v["endtime"] * 1000).toLocaleString().substr(0, 10);
	$("#kechengliebiao>article>ul").append("<li dataid=" + v["xianxiapeixunid"] + ">" + "<a href=/fenxiang/peixun.html?dataid=" + v["id"] + ">" + "<img src=" + http + v["ico"] + ">" + "<h1>" + v["title"] + "</h1>" + "<div></div><h3>" + start + "-" + end + "</h3>" + "</a>" + "</li>");
}
//历史课程
function li(v, fenlei) {
	var start = new Date(v["starttime"] * 1000).toLocaleString().substr(0, 10);
	var end = new Date(v["endtime"] * 1000).toLocaleString().substr(0, 10);
	if(fenlei) {
		$("#kechengpeixun>article>.xixi>.lishi>.nei>ul").append("<li dataid=" + v["id"] + ">" + "<a href=/fenxiang/peixun.html?dataid=" + v["id"] + ">" + "<img src=" + http + v["ico"] + ">" + "<h1>" + v["title"] + "</h1>" + "<div></div>" + "<h3>" + start + "-" + end + "</h3>" + "<h4>" + "查看详情" + "</h4>" + "</a>" + "</li>")
	} else {
		$("#lishiliebiao>article>ul").append("<li dataid=" + v["id"] + ">" + "<a href=#kechengzhuti>" + "<img src=" + http + v["ico"] + ">" + "<h1>" + v["title"] + "</h1>" + "<div></div>" + "<h3>" + start + "-" + end + "</h3>" + "<h4>" + "查看详情" + "</h4>" + "</a>" + "</li>")
	}
}

$("#px").click(function() {
	new Ajax("/xianxiapeixun").keyvalue("type", 4).getJson(function(json) {
		$("#kechengpeixun>article>.xixi>.lishi>.nei>ul").empty();
		$.each(json, function(v, k) {
			li(k, 3);
		})
	})
})

function shi(v) {
	var start = new Date(v["starttime"] * 1000).toLocaleString().substr(0, 10);
	var end = new Date(v["endtime"] * 1000).toLocaleString().substr(0, 10);
	$("#lishiliebiao>article>ul").append("<li dataid=" + v["id"] + ">" + "<a href=/fenxiang/peixun.html?dataid=" + v["id"] + ">" + "<img src=" + http + v["ico"] + ">" + "<h1>" + v["title"] + "</h1>" + "<div></div>" + "<h3>" + start + "-" + end + "</h3>" + "<h4>" + "查看详情" + "</h4>" + "</a>" + "</li>");
}
$("#kechengpeixun>article>.xixi>.lishi>.jiazai_1").on("click", function() {
	$("#lishiliebiao>article>ul").empty();
	new Ajax("/xianxiapeixun").keyvalue("type", 5).getJson(function(json) {
		$.each(json, function(v, k) {
			shi(k);
		})
	})
})